<!DOCTYPE html>
<!-- saved from url=(0059)http://www.hasbei.com/qa/detail/202008011289396856023027712 -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>[[${question.getQContent()}]]-口腔问题-有贝口腔网</title>
    <meta name="keywords" th:content="${question.getQContent()}+'有贝口腔网,口腔问答,口腔问题'">
    <meta name="description" th:content="${question.getQContent()}+'有贝口腔网为用户提供专业的口腔资讯，口腔知识，口腔问题等综合服务型网站'">
    <link rel="stylesheet" href="/css/reset.css">
    <link rel="stylesheet" href="/css/commone.css">
    <link rel="stylesheet" href="/css/commthree.css">
    <link rel="stylesheet" href="/css/pinglun.css">
    <link rel="stylesheet" media="screen and (min-width:481px)" href="/css/qadetail.css">
    <link rel="stylesheet" media="screen and (max-width:480px)" href="/css/qadetail(1).css">

    <script src="/js/hm.js"></script>
    <script type="text/javascript">
        var basePath = "/";
    </script>
    <script src="/js/common.js"></script>
    <script src="/js/jquery-3.5.1.min.js"></script>
    <script src="/js/footfixed.js"></script>

    <script src="http://www.hasbei.com/static/layer/layer.js" type="text/javascript"></script>
    <link rel="stylesheet" href="http://www.hasbei.com/static/layer/theme/default/layer.css?v=3.1.1" id="layuicss-layer">
    <script src="/js/wangEditor.min.js"></script>
</head>

<body>
<div class="content">

    <!--头部-->
    <div class="content-top">
        <div th:include="/user_page/usercenter_head :: usercenterhead"></div>
    </div>

    <!--分类-->
    <div th:include="answers/answers_title"></div>

    <div class="content-main">

        <input type="hidden" id="no" value="202008011289396856023027712">
        <input type="hidden" id="collectType" value="20">
        <div class="box-bg-shadow">
            <div class="qa-top">
                <a class="qa-type" href="http://www.hasbei.com/qa/2">[[${question.getTitle().getTname()}]]</a>
                <a class="ansower-type" href="http://www.hasbei.com/user/1281956378608537600">
                    <img src="/icon/user_Default.png" th:if="${question.getUserQ().getUImgUrl()} eq null">
                    <img th:src="@{${question.getUserQ().getUImgUrl()}}" th:if="${question.getUserQ().getUImgUrl()} ne null">
                    <span class="user-name">[[${question.getUserQ().getUName()}]]</span>
                </a>
                <a class="please-ansower" href="javascript:;"> 遇到下面问题，需要你帮忙解答</a>
            </div>

            <div class="qa-title">[[${question.getQContent()}]]</div>

            <div class="qa-bg">
                <span class="title-text">[问题背景]：</span>
                <div class="bg-content">
                    <p>
                        [[${question.getQAbstract()}]]
                    </p>
                </div>
                <div class="shou-all-bg" style="">
                    <div class="bg-div"></div>
                    <span>展开全部</span>
                </div>
            </div>

            <div class="qa-info-share">
                <div class="qa-info">

                    <a href="javascript:;" class="huida-num">
                        <img src="/icon/icon_News.png" alt="有贝口腔网">
                        <span>[[${question.getQCommentSum()}]]个回答</span>
                    </a>
                    <a href="javascript:;" class="thumbs-up">
                        <img src="/icon/icon_Browse.png" alt="有贝口腔网">
                        <span>[[${question.getQReadSum()}]]阅读</span>
                    </a>
                    <!-- <a href="" class="share">
                        <img src="images/icon_Share.png" alt="有贝口腔网">
                        <span>4分享</span>
                    </a> -->
                    <a href="javascript:;" class="conllection" onclick="myCollect(this)">
                        <img src="/icon/shoucang1.png" alt="有贝口腔网">
                        <span id="collectType20">收藏问题([[${question.getQCollectSum()}]])</span>
                    </a>
                    <span class="time">[[${question.getQOkDate()}]]</span>
                </div>

            </div>

            <div class="editor-div">
                <div id="editor2">
                    <p class="tip-text" style="color: #999">请输入相关口腔文章、资讯内容</p>
                </div>
                <div class="edditor-bottom">
                    <div>字数 <span class="length">0</span></div>
                    <div class="sub-btn">发表回答</div>
                </div>
            </div>

            <!------------------------------------------------------------------------------------------------------->

            <div class="more-content" th:if="${listReply eq null or listReply.size() le 0}">
                <div class="load-more" style="display:none">
                    <img src="/img/load-more.gif" alt="有贝口腔网">
                    <span>加载中</span>
                </div>

                <div class="no-data">还没有人回答该问题哦，需要您来帮忙回答~</div>
            </div>

            <!------------------------------------------------------------------------------------------------------->
            <div class="qa-list-item" th:each="reply:${listReply}" th:if="${listReply ne null} and ${listReply.size() gt 0} ">
                <div class="list-item-user">
                    <div class="user-img-name">
                        <a class="user-img" th:href="@{'/user/'+${reply.getUser().getUId()}}" target="_blank">
                            <img th:if="${reply.getUser().getUImgUrl()} ne null" th:src="${reply.getUser().getUImgUrl()}" >
                            <img th:if="${reply.getUser().getUImgUrl()} eq null" src="/icon/user_Default.png" >
                        </a>
                        <div class="qa-name-time">
                            <a href="/user/1282955775085514752" target="_blank">[[${reply.getUser().getUName()}]]</a>
                            <span>[[${reply.getROkDate()}]]</span>
                        </div>
                    </div>
                </div>

                <div class="list-item-content"><p>[[${reply.getRContent()}]]<br></p></div>

                <div class="show-all" style="display: none;">
                    <div class="bg-div"></div>
                    <span>展开全部</span>
                </div>

                <div class="qa-info">
                    <a href="javascript:;" class="thumbs-up" th:onclick="|javascript:addPraise(this,${reply.getRId()},${reply.getRPraiseSum()})|" >
                        <img src="/icon/icon_Like.png" alt="有贝口腔网">
                        <span id="qaReplyLikeCount339">[[${reply.getRPraiseSum()}]]点赞</span>
                    </a>
                    <a href="javascript:;" class="thumbs-down" th:onclick="|javascript:addTread(this,${reply.getRId()},${reply.getRTrampleSum()})|">
                        <img src="/icon/icon_Like.png" alt="有贝口腔网">
                        <span id="qaReplyStepCount339">[[${reply.getRTrampleSum()}]]踩</span>
                    </a>

                    <!--<a href="javascript:;" class="comment-on five" th:onclick="|javascript:commentInit(this,${reply.getRId()})|" >
                        <img src="/icon/icon_News.png" alt="有贝口腔网">
                        <span id="commentCount">0评论</span>
                    </a>-->
                    <a href="javascript:;" class="comment-on five" th:onclick="|javascript:commentInit(this,${reply.getRId()},${reply.getCommentSum()})|" >
                        <img src="/icon/icon_News.png" alt="有贝口腔网">
                        <span th:id="'commentCount'+${reply.getRId()}">[[${reply.getCommentSum()}]]评论</span>
                    </a>

                    <span class="time">[[${reply.getROkDate()}]]</span>
                </div>

                <div class="pinglun">

                    <div class="publish-discuss">
                        <div class="user-logo">
                            <a href="/user/1285053398860828672">
                                <img th:if="${loginUser} eq null" src="/icon/user_Default.png">
                                <img th:if="${loginUser}" th:src="@{${loginUser.getU_img_url()}}">
                            </a>

                        </div>
                        <div class="discuss-input" style="height: 40px;">
                            <textarea th:onfocus="|javascript:acquire(this)|" placeholder="写下您的评论..." class="textarea" th:id="'commentContent'+${reply.getRId()}"></textarea>
                            <div class="answer-div" style="position: absolute;" >
                                <span class="answer-btn" th:onclick="|javascript:btdAddComment(this,${reply.getRId()},0)|">评论</span>
                            </div>
                        </div>
                    </div>

                    <div class="discuss-box" th:id="'commentList'+${reply.getRId()}">
                        <!--显示评论-->
                    </div>

                    <div class="show-more" th:onclick="|javascript:moreCommentlist(this,${reply.getRId()})|" >查看更多评论</div>

                </div>
            </div>
            <!------------------------------------------------------------------------------------------------------->
            <div class="show-more" th:onclick="|javascript:moreReplylist(this,${question.getQId()})|" >查看更多回答</div>
        </div>


        <div class="aside-left">

            <div class="wonderful-top">
                <div class="wonderful-top-title">
                    <img src="/img/Linkeddatabases.png" alt="有贝口腔网">
                    <span>相关问题</span>
                </div>

                <div class="aside-qa-list" th:each="q:${listQ}">
                    <a th:href="'/answers/particulars/'+${q.getQId()}">
                        <span class="aside-qa-title">[[${q.getQContent()}]]</span>
                    </a>
                    <a th:href="'/answers/particulars/'+${q.getQId()}">
                        <span class="aside-qa-ansower">[[${q.getQCommentSum()}]]个回答</span>
                    </a>
                </div>
            </div>

            <div class="wonderful-top">
                <div class="wonderful-top-title">
                    <!-- <img src="/static/images/rmd.png" alt="有贝口腔网"> -->
                    <span>大家都在问</span>
                </div>

                <div class="wonderful-ansewer-list">
                    <div class="ansewer-list-item" th:each="question,iterStat:${listQuestion}">
                        <span th:class="${iterStat.count <= 3}?'pink-bg':''">[[${iterStat.count}]]</span>
                        <div>
                            <a target="_blank" class="ansewer-list-title" th:href="@{'/qa/detail/'+${question.getQId()}}">[[${question.getQContent()}]]</a>
                            <div class="ansewer-list-info">
                                <a target="_blank" th:href="@{'/qa/detail/'+${question.getQId()}}">
                                    <!-- <img src="/static/images/Write.png" alt=""> -->
                                    <span class="ansewer-list-info-ansewer">回答</span>
                                </a>
                                <a target="_blank" th:href="@{'/qa/detail/'+${question.getQId()}}">[[${question.getQCommentSum()}]]个回答</a>
                                <span class="dotted"></span>
                                <a target="_blank" th:href="@{'/qa/detail/'+${question.getQId()}}">[[${question.getQReadSum()}]]阅读</a>
                                <span class="dotted"></span>
                                <a target="_blank" th:href="@{'/qa/detail/'+${question.getQId()}}">[[${question.getQCollectSum()}]]收藏</a>
                            </div>
                        </div>
                    </div>
                </div>

            </div>

        </div>

    </div>
    <!--尾部-->
    <div th:replace="common/hasbei_bottom"></div>
    <script>
        var _hmt = _hmt || [];
        (function () {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?4245936cbef31e434e2b387b56dfd7d8";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>


</div>

</body>

<script th:inline="javascript">
    /* <![CDATA[ */
    //编辑器
    var E = window.wangEditor;
    var editor = new E('#editor2');
    editor.customConfig.uploadImgServer = basePath+'qa/uploadFile';
    // 将图片大小限制为 1M
    editor.customConfig.uploadImgMaxSize = 1 * 1024 * 1024;
    editor.customConfig.uploadFileName = 'upfile';
    // 将 timeout 时间改为 10s
    editor.customConfig.uploadImgTimeout =10000;
    editor.customConfig.customAlert = function (info) {//自定义错误提示信息
        layer.msg(info);
    }

    editor.customConfig.menus = [
        'head',  // 标题
        'bold',  // 粗体
        'fontSize',  // 字号
        'fontName',  // 字体
        'italic',  // 斜体
        'underline',  // 下划线
        'strikeThrough',  // 删除线
        'foreColor',  // 文字颜色
        'backColor',  // 背景颜色
        'link',  // 插入链接
        'list',  // 列表
        'justify',  // 对齐方式
        'quote',  // 引用
        //'emoticon',  // 表情
        'image',  // 插入图片
        'table',  // 表格
        //'video',  // 插入视频
        // 'code',  // 插入代码
        'undo',  // 撤销
        'redo'  // 重复
    ]

    editor.customConfig.onchangeTimeout = 1 // 单位 ms

    editor.customConfig.pasteTextHandle = function (content) {
        return delHtmlTag(content);//去除复制带来的标签代码
    }

    editor.customConfig.onchange = function () {
        var articallength =editor.txt.text().length;
        $(".length").text(articallength);
    }

    editor.customConfig.onfocus = function () {
        $(".tip-text").remove();
    }

    editor.create();

    //添加回答审核点击事件
    $(".sub-btn").click(function(){

        //登录判断
        if(!userLogin()){
            window.location.href = '/login';
            return false;
        }

        $(".tip-text").remove();
        var content = editor.txt.text();
        if(content == '' || content.length < 10){
            layer.msg("请输入回答10以上个字符");
            return false;
        }

        addReply(editor.txt.html());//回答
    });

    console.log([[${loginUser}]])

    //登录判断
    function userLogin(){
        var userId = [[${userId}]];
        if(userId){
            console.log('已登录')
            return true;
        }else{
            var url = window.location.href;
            setCookie('URL', url, 30);
            return false;
        }
    }

    function setCookie(cname, cvalue, exdays) {
        var d = new Date();
        d.setTime(d.getTime() + (exdays * 60 * 1000));
        var expires = "expires=" + d.toUTCString();
        document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/";
    }

    //添加回答审核
    function addReply(content) {
        if(isBlank(content)){
            alert("请输入回答内容");
            return ;
        }
        //var no=$("#no").val();

        var replyAudit = {
            rquestionId:[[${question.getQId()}]],
            rcontent:content,

        };
        $.ajax({
            type : "POST",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url: "/replyAudit/add",
            //数据，json字符串
            data: JSON.stringify(replyAudit),
            success : function(data) {
                if (data.boo) {
                    layer.msg("恭喜你，回答成功，待审核中");
                    editor.txt.html('');
                } else {
                    layer.msg("亲,回答失败了- _ -！");
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                alert("链接错误,请联系管理员");
            }
        });
    }

    //查询更多回答
    var replyPages = {
        pageSize:5,
        startPage:1,
        state:1,
        questionId:0
    }
    function moreReplylist(thisDom,qid) {
        replyPages.startPage++;
        replyPages.questionId = qid;
        $.ajax({
            type : "POST",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url: "/reply/inquirePagesReplyHtml",
            //数据，json字符串
            data: JSON.stringify(replyPages),
            success : function(data) {
                if(data != null && data != ''){
                    $(thisDom).before(data);
                }else{
                    layer.msg("亲,已经到底了哦！");
                    $(thisDom).css("display","none");
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                alert("链接错误,请联系管理员");
            }
        });
    }

    //赞点击事件
    var praiseIndex = 0;
    function addPraise(thisDom,replyId,praise){
        if(praiseIndex == 0){
            if(treadIndex != 0){
                layer.msg("亲,请先取消点踩哦！");
                return false;
            }

            //点赞
            praise_tread("/reply/praiseSumAnd1/"+replyId,thisDom,praise);
        }else {
            //取消点赞
            praise_tread("/reply/praiseSumSubtract1/"+replyId,thisDom,praise);
        }
    }
    //踩点击事件
    var treadIndex = 0;
    function addTread(thisDom,replyId,tread){
        if(treadIndex == 0){
            if(praiseIndex != 0){
                layer.msg("亲,请先取消点踩哦！");
                return false;
            }
            ;
            //点踩
            praise_tread("/reply/trampleSumAnd1/"+replyId,thisDom,tread);
        }else {
            //取消点踩
            praise_tread("/reply/trampleSumSubtract1/"+replyId,thisDom,tread);
        }
    }
    //赞或踩
    function praise_tread(url,thisDom,praise_tread_sum) {
        $.ajax({
            type : "GET",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url: url,
            success : function(data) {
                if(data != null && data.boo){
                    if(url.indexOf("/reply/praiseSumAnd1/") != -1){
                        $(thisDom).find("img").attr("src","/icon/icon_Like-active.png");
                        $(thisDom).find("span").text((praise_tread_sum + 1) +"点赞");
                        praiseIndex++;
                    }else if(url.indexOf("/reply/praiseSumSubtract1/") != -1){
                        $(thisDom).find("img").attr("src","/icon/icon_Like.png");
                        $(thisDom).find("span").text(praise_tread_sum +"点赞");
                        praiseIndex--;
                    }else if(url.indexOf("/reply/trampleSumAnd1/") != -1){
                        $(thisDom).find("img").attr("src","/icon/icon_Like-active.png");
                        $(thisDom).find("span").text((praise_tread_sum + 1) +"点踩")
                        treadIndex++;
                    }else if(url.indexOf("/reply/trampleSumSubtract1/") != -1){
                        $(thisDom).find("img").attr("src","/icon/icon_Like.png");
                        $(thisDom).find("span").text(praise_tread_sum  +"点踩");
                        treadIndex--;
                    }
                        layer.msg("亲,"+data.describe+"！");
                }else{
                        layer.msg("亲,点赞或踩失败了哦，请重试！");
                }
                //console.log(data);
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                alert("链接错误,请联系管理员");
            }
        });
    }

    var commentPages = {
        startPage:1,
        pageSize:5,
        state:1,
        type:2,
        parentId:0
    }
    //评论点击事件
    function commentInit(thisDom,replyId,commentSum){

        //缩小所有输入框
        $(".discuss-input").css("height","40px");
        $(".discuss-input").find(".answer-div").css("position","absolute");
        $("textarea").removeClass("textarea-train");

        var val = $("#pinglun"+replyId).css("display");
        if(val == 'none'){
            $(".pinglun").css("display","none");//隐藏其他展开评论

            $("#pinglun"+replyId).css("display","");
        }else{
            $("#pinglun"+replyId).css("display","none");
        }
        console.log(val);

        commentPages = {
            startPage:1,
            pageSize:5,
            state:1,
            type:2,
            parentId:replyId
        }
        if(commentSum > 0){
            //查询评论
            inquireComment(commentPages,replyId);
        }

    }
    //点击查询更多评论事件
    function moreCommentlist(thisDom,replyId){
        commentPages.startPage++;
        commentPages.parentId = replyId;

        //查询评论
        inquireComment(commentPages,replyId,thisDom);
    }
    //查询评论
    function inquireComment(commentPages,replyId,thisDom){
        $.ajax({
            type : "POST",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url: "/comment/inquirePagesDataHtml",
            //数据，json字符串
            data: JSON.stringify(commentPages),
            success : function(data) {
                if(data != null && data != ''){
                    //console.log(data);
                    if (commentPages.startPage > 1){//追加
                        $("#commentList"+replyId).append(data);
                    }else {//替换
                        $("#commentList"+replyId).html(data);
                    }
                }else{
                    if (commentPages.startPage > 1) {
                        layer.msg("亲,已经到底了哦！");
                        $(thisDom).css("display","none");
                    }
                }
                //console.log(data);
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                alert("链接错误,请联系管理员");
            }
        });
    }

    //输入框获得焦点
    function acquire(thisDom){
        //缩小所有输入框
        $(".discuss-input").css("height","40px");
        $(".discuss-input").find(".answer-div").css("position","absolute");
        $("textarea").removeClass("textarea-train");

        //放大当前获得焦点的输入框
        $(thisDom).parent().css("height","auto");
        $(thisDom).next().css("position","static");
        $(thisDom).addClass("textarea-train");
    }

    //添加评论
    function btdAddComment(thisDom,parentId,textId){

        //登录判断
        if(!userLogin()){
            window.location.href = '/login';
            return false;
        }

        var comment = {};
        var userId = [[${userId}]];

        if(textId){//回复
            var content ="";

            if(parentId == textId){//评论回复
                content = $("#content"+parentId).val();//内容
                comment = {
                    ccontent:content,
                    cuserId:userId,
                    cparentId:replyId,
                    ctextId:textId,
                    ctype:3
                }

            }else{//回复回复
                content = $("#contentTo"+parentId).val();//内容
                comment = {
                    ccontent:content,
                    cuserId:userId,
                    cparentId:parentId,
                    ctextId:textId,
                    ctype:3
                }
            }

            if(content == "" || content == null ){
                layer.msg("亲,回复内容不能为空哦！");
                return false;
            }

        }else{//评论
            var content = $("#commentContent"+parentId).val();
            comment = {
                ccontent:content,
                cuserId:userId,
                cparentId:parentId,
                ctype:2
            }
            if(content == "" || content == null ){
                layer.msg("亲,评论内容不能为空哦！");
                return false;
            }
        }
        console.log(comment);
        $.ajax({
            type : "POST",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url: "/comment/add",
            //数据，json字符串
            data: JSON.stringify(comment),
            success : function(data) {
                if(data.boo){//成功
                    var id = data.data;
                    if(textId){//回复
                        if(parentId == textId){//评论回复
                            //清空输入框
                            $("#content"+parentId).val('');
                        }else{//回复回复
                            //清空输入框
                            $("#contentTo"+parentId).val('');
                        }
                        //将添加的评论回复渲染到页面
                        inquireRevertById(id,parentId,textId);
                        layer.msg("亲,回复成功了^ v ^！");
                    }else{//评论
                        //清空输入框
                        $("#commentContent"+parentId).val('');
                        //将添加的评论渲染到页面
                        inquireCommentById(id,parentId);
                        layer.msg("亲,评论成功了^ v ^！");
                    }
                }else{//失败
                    if(textId){
                        layer.msg("亲,回复失败了- _ -！");
                    }else{
                        layer.msg("亲,评论失败了- _ -！");
                    }
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                alert("链接错误,请联系管理员");
            }
        });
    }
    //根据id查询评论
    function inquireCommentById(id,parentId,textId) {
        $.ajax({
            type : "POST",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url: "/comment/inquireCommentByIdHtml/"+id,
            success : function(data) {
                if(data != null){
                    //显示
                    $("#commentList"+parentId).prepend(data);
                }else{

                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                alert("链接错误,请联系管理员");
            }
        });
    }
    //根据id查询评论的回复
    function inquireRevertById(id,parentId,textId) {
        $.ajax({
            type : "POST",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url: "/comment/inquireRevertByIdHtml/"+id,
            success : function(data) {
                if(data != null){
                    //console.log(data);
                    //显示
                    if(parentId == textId){//评论回复
                        $("#revertList"+parentId).css("display","");
                        //渲染到页面
                        $("#revertList"+parentId).prepend(data);
                    }else{//回复回复
                        //渲染到页面
                        $("#revertList"+textId).prepend(data);
                    }

                }else{

                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                alert("链接错误,请联系管理员");
            }
        });
    }


    var revertPages = {
        startPage:1,
        pageSize:5,
        state:1,
        type:3,
        textId:0
    }
    //查询回复（textId就是评论id）
    function inquireRever(thisDom,textId){
        var $revertList = $("#revertList"+textId);
        var val = $revertList.css("display");
        if(val == "none"){
            //关闭所有打开的回复显示
            $(".more-answer").css("display","none");
            $(".answer-num").find(".arrow-img").removeClass("arrow-img-train");

            $revertList.css("display","");
            $("#answer-num"+textId).find(".arrow-img").addClass("arrow-img-train");

            revertPages = {//初始化
                startPage:1,
                pageSize:5,
                state:1,
                type:3,
                textId:textId
            }
            inquireRevert(thisDom,textId);//查询回复
            
            //显示更多按钮
            $("#revertList"+textId).next().css("display","");
        }else{
            $revertList.css("display","none");
            $("#answer-num"+textId).find(".arrow-img").removeClass("arrow-img-train");

            //关闭更多按钮
            $("#revertList"+textId).next().css("display","none");
        }
        console.log(val)
    }
    //点击查询更多回复
    function moreCommentReplylist(thisDom,textId){
        revertPages.startPage++;
        revertPages.textId = textId;
        inquireRevert(thisDom,textId);//查询回复
    }
    //查询回复
    function inquireRevert(thisDom,textId){
        $.ajax({
            type : "POST",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url: "/comment/inquirePagesRevertDataHtml",
            //数据，json字符串
            data: JSON.stringify(revertPages),
            success : function(data) {
                if(data != null && data != ''){
                    if(revertPages.startPage > 1){//追加
                        $("#revertList"+textId).append(data);
                    }else{//替换
                        $("#revertList"+textId).html(data);
                    }
                }else{
                    layer.msg("亲,已经到底了哦！");
                    $(thisDom).css("display","none");
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                alert("链接错误,请联系管理员");
            }
        });
    }

    //点击回复事件
    function addlike(thisDom,commentId){
        //缩小所有输入框
        $(".discuss-input").css("height","40px");
        $(".discuss-input").find(".answer-div").css("position","absolute");
        $("textarea").removeClass("textarea-train");

        $('.posi-input').css("display","none");
        $('.erji-input').css("display","none");
        $('#posi-input'+commentId).css("display","");
    }

    //点击回复的回复事件
    function addlike_s(thisDom,commentId){
        //缩小所有输入框
        $(".discuss-input").css("height","40px");
        $(".discuss-input").find(".answer-div").css("position","absolute");
        $("textarea").removeClass("textarea-train");

        $('.posi-input').css("display","none");
        $('.erji-input').css("display","none");
        $('#erji-input'+commentId).css("display","");
    }

    //评论赞点击事件
    var commrntIndex = 0;
    function commrntPraise(thisDom,commentId,praise_tread_sum){
        if(commrntIndex == 0){
            //点赞
            commrntPra("/comment/giveALike/"+commentId,thisDom,praise_tread_sum);
        }else {
            //取消点赞
            commrntPra("/comment/cancelGiveALike/"+commentId,thisDom,praise_tread_sum);
        }
    }

    //查评论点赞
    function commrntPra(url,thisDom,praise_tread_sum){
        $.ajax({
            type : "POST",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url: url,
            success : function(data) {
                if(data != null && data.boo){
                    if(commrntIndex == 0){
                        //点赞
                        $(thisDom).find("img").attr("src","/icon/icon_Like-active.png");
                        $(thisDom).find("span").text(praise_tread_sum + 1);
                        layer.msg("亲,点赞成功了哦！");
                        commrntIndex++;
                    }else {
                        //取消点赞
                        $(thisDom).find("img").attr("src","/icon/icon_Like.png");
                        $(thisDom).find("span").text(praise_tread_sum);
                        layer.msg("亲,取消点赞成功了哦！");
                        commrntIndex--;
                    }
                }else{
                    layer.msg("亲,点赞失败了哦！");
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                alert("链接错误,请联系管理员");
            }
        });
    }

    //===评论事件
    $(function(){
        qaPinglunInitEv();
        initOverflow();
    })

    function qaPinglunInitEv(){
        $(".asdn").hide();
        $(".show-all").unbind("click");
        $(".show-all").click(function(){
            $(".asdn").show();
            $(this).hide();
        })


        $(".pinglun").hide();
        $(".five").unbind("click");
        $(".five").click(function(){//点击评论展开评论内容
            if($(this).parent().next().is(':hidden')){//如果是隐藏就就显示
                $(".pinglun").hide();//先隐藏其他已展开的评论
                $(this).parent().next().show();//再次展开自己
            }else{//因此
                $(this).parent().next().hide();
            }
        });
    }

    function initOverflow(){
        // 太长隐藏点击展开
        $(".show-all").hide();
        $(".list-item-content").each(function (i,dom){
            if($(this).height() > 300){
                $(this).next().show();
                $(this).addClass("overflow-content");
            }else{
                $(this).next().hide();
                $(this).removeClass("overflow-content");
            }
        })
        $(".show-all").click(function(){
            $(this).prev(".list-item-content").removeClass("overflow-content");
            $(this).hide();
        })

        //问题背景隐藏
        $(".shou-all-bg").hide();
        if($(".bg-content").height() > 100){
            $(".bg-content").addClass("qa-bg-show");
            $(".shou-all-bg").show();
        }
        $(".shou-all-bg").click(function(){
            $(".bg-content").removeClass("qa-bg-show");
            $(this).hide();
        })
    }

    /* ]]> */

</script>

</html>